package com.ad.pet.app.account.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.ad.pet.R;
import com.ad.pet.common.data.utils.glide.GlideUtil;
import com.ad.pet.models.remote.account.order.OrderType;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by SEELE on 2019/2/14.
 */

public class OrderDetailGoodAdapter extends BaseQuickAdapter<OrderType, BaseViewHolder> {
    private OnOrderStatusLinstener mOnOrderStatusLinstener;
    public OrderDetailGoodAdapter(@Nullable List<OrderType> data) {
        super(R.layout.item_status_common_good_layout2, data);
    }


    public void setOnOrderStatusLinstener(OnOrderStatusLinstener onOrderStatusLinstener) {
        mOnOrderStatusLinstener = onOrderStatusLinstener;
    }

    @Override
    protected void convert(final BaseViewHolder helper, OrderType item) {
        ImageView iv_head = helper.getView(R.id.iv_head);
        TextView tvTitle = helper.getView(R.id.tvTitle);
        TextView tvPrcie = helper.getView(R.id.tv_price);
       TextView tvNumber = helper.getView(R.id.tv_number);
       tvNumber.setText("x"+item.getNum());
        GlideUtil.load(mContext,item.getPic_cover_big(),iv_head);
//        tvPrcie.setText("￥"+(TextUtils.isEmpty(item.getGoods_money())?item.getPrice():item.getGoods_money()));
        tvPrcie.setText("￥"+item.getPrice());
        tvTitle.setText(TextUtils.isEmpty(item.getOffservice_name())?item.getGoods_name():item.getOffservice_name());
    }

    /**
     * 订单列表状态用户点击监听器，包括是否确认收货，是否评价等
     */
    public interface OnOrderStatusLinstener{
        void onOrderClick(int position);
    }

}
